package com.qbw.app.module.vehicle.holder;

import android.content.Context;
import android.view.ViewGroup;

import androidx.recyclerview.widget.LinearLayoutManager;

import com.qbw.app.R;
import com.qbw.app.databinding.VehicleHolderNotificationItemBoxBinding;
import com.qbw.app.model.Warning;
import com.qbw.app.module.common.holder.CommonHolder;
import com.qbw.app.module.vehicle.adapter.VehicleNotificationAdapter;

/**
 * @author QBW
 * @date 2019-10-03
 */
public class VehicleNotificationItemBoxHolder extends CommonHolder<Warning.Box, VehicleHolderNotificationItemBoxBinding> {

    private VehicleNotificationAdapter mAdapter;

    public VehicleNotificationItemBoxHolder(Context context, ViewGroup viewParent) {
        super(context, R.layout.vehicle_holder_notification_item_box, viewParent);
        mBinding.rcv.setLayoutManager(new LinearLayoutManager(mContext));
        mAdapter = new VehicleNotificationAdapter(mContext);
        mBinding.rcv.setAdapter(mAdapter);
    }

    @Override
    public void bindData(int position, Warning.Box data) {
        super.bindData(position, data);
        mBinding.tvTitle.setText(data.getTitle());
        mAdapter.clear();
        mAdapter.addChild(data.getList().getList());
    }

}
